package com.coinworld.consumer;

import com.coinworld.entity.vo.RabbitmqVo;
import com.coinworld.log.MqErrorLog;
import com.google.gson.Gson;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MsgReciver {

    private Logger logger= LoggerFactory.getLogger(MsgReciver.class);

//    @Autowired
//    RewardHandler handler;

    @RabbitListener(queues = "rewardQueue")
    @RabbitHandler
    public void receive(RabbitmqVo vo) {
        try{
          //  handler.sendRewardByType(vo);
        }catch(Exception e){
            MqErrorLog.logData(new Gson().toJson(vo));
            logger.error("processMqMsg error:",e);
        }
    }

}
